#ifndef REPOSITORY_H_
#define REPOSITORY_H_


#include <iostream>
#include <fstream>
#include <map>
#include <cstdio>


#include "../classes_teste/Estatistica.h"


#include <boost/tr1/memory.hpp>
#include <boost/thread/mutex.hpp>


using namespace std; // temporario

class Repository{
private:
	Repository();		
	
public:
	static std::tr1::shared_ptr<Repository> getInstance() {return theRepository;}
	~Repository();
	
	void storeCounter(void);
//	void store(string _url, string _page);
//	void newOldStore(string _url, string _page);

	
//	int size(void);
//	string getPage(string _url);
	
	static void setContador (unsigned long int numPaginas) { contador = numPaginas;}
	static uint getContador (void) { return contador;}
	

	
private:
//	bool isEmpty(string hash);
	
	
	map<string,string> mapa;
	map<string,string>::iterator it;
	//ofstream fileToDisk;

//	FILE * fileToDisk[32];
//	FILE *outHashFile;

	static int numStores;
	
	//Apenas 1 copia
	 static std::tr1::shared_ptr<Repository> theRepository;
	 static boost::mutex storeMutex;
     
	 //para estatistica
     static unsigned long int contador;
     Estatistica contadorPaginas;
};

#endif /*REPOSITORY_H_*/
